package org.fioma.tree.suffixTree.memory;

import org.fioma.tree.SimpleLeaf;
import org.fioma.tree.bytes.LabelRefBytesIndex;
import org.fioma.tree.suffixTree.LeafSuffixNode;

public class LeafSuffixNodeMemory<L extends LabelRefBytesIndex, I extends InternalSuffixNodeMemory<L, I, F>, F extends LeafSuffixNodeMemory<L, I, F>> extends
		SimpleLeaf<L, I, F> implements LeafSuffixNode<L, I, F> {

	private long pos;
	private SuffixNodeFactoryMemory<L, I, F> memory;

	public LeafSuffixNodeMemory(SuffixNodeFactoryMemory<L, I, F> memory, long pos) {
		super(null, null);
		this.pos = pos;
		this.memory = memory;
	}

	@Override
	public I getParent() {
		return memory.getParent(pos);
	}

	@Override
	public void setParent(I parent) {
		memory.setParent(pos, parent);
	}

	@Override
	public L getLabel() {
		return memory.getLabel(pos);
	}

	@Override
	public void setLabel(L label) {
		memory.setLabel(pos, label);
	}

}
